package com.example.xunua_mymusic.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.example.xunua_mymusic.R;

import org.w3c.dom.Text;

import java.util.zip.Inflater;

public class MyAdapterabc extends BaseAdapter {
    String[] abc={"#","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"};
    Context context;

    public MyAdapterabc(Context context) {
        this.context = context;
    }

    @Override
    public int getCount() {
        return abc.length;
    }

    @Override
    public Object getItem(int position) {
        return abc[position];
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder=null;
        if (convertView == null) {
            holder=new ViewHolder();
            convertView= LayoutInflater.from(context).inflate(R.layout.lv_item_abc,null);
            holder.tv=convertView.findViewById(R.id.lv_item_abc_tv);
            convertView.setTag(holder);
        }else {
            holder= (ViewHolder) convertView.getTag();
        }
        holder.tv.setText(abc[position]);
        return convertView;
    }
    private class ViewHolder{
        TextView tv;
    }
}
